<%@page import="org.springframework.security.core.context.SecurityContextHolder"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="org.apache.commons.lang.time.DateFormatUtils"%>
<%@page import="org.springframework.util.CollectionUtils"%>
<%@page import="java.util.Collection"%>
<%@ include file="../common/common_include.jsp"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	DestinForm form = (DestinForm)request.getAttribute("command");
	UserInfo user = (UserInfo)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	String userName = user.getName();
	String siteId = user.getSiteId();	
	
	TblDestination destin = (TblDestination)request.getAttribute("destin");
	if(null!=request.getAttribute("destin")){
		destin = (TblDestination)request.getAttribute("destin");
	}

%>
<div>
<div style="display: none">SomeRandomString</div>
	<form id="DestinAddForm" target="_coreIframe" method="post" action="<%=request.getContextPath()%>/destin/doEdit" enctype="multipart/form-data">
		<div class="breadcrumb">
			<div class="bcIcon"></div>
			<ul class="bcNav">
				<li>编辑地址</li>
			</ul>
		</div>
		<table class="formTable">
			<tr>
				<td class="tdTitle">省份：</td>
				<td>
					<select id="prov" class="easyui-combobox" name="prov" style="width:200px;">
					</select>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">地级市：</td>
				<td>
					<select id="city" class="easyui-combobox" name="city" style="width:200px;">
					</select>							
				</td>
			</tr>
			<tr>
				<td class="tdTitle">县/市辖区：</td>
				<td>
					<select id="area" class="easyui-combobox" name="area" style="width:200px;">
					</select>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">详细地址：</td>
				<td>
					<input class="inputText l" type="text" value="<%=destin.getAddress()!=null?destin.getAddress():"" %>" name="address">
					<span class="errorTipWrap" id="errorTip_address"></span>
				</td>
			</tr>				
			<tr>
				<td class="tdTitle">目的地：</td>
				<td>
					<input class="inputText xs" type="text" value="<%=destin.getAreaname() %>" name="areaname">
					<span class="errorTipWrap" id="errorTip_areaname"></span>
				</td>
			</tr>
			<tr>
				<td class="tdTitle">备注：</td>
				<td>
					<input class="inputText l" type="text" value="<%=destin.getMemotext() %>" placeholder="可不填" name="memotext">
					<span class="errorTipWrap" id="errorTip_memotext"></span>
				</td>
			</tr>				
			<input type="hidden" name="id" value="<%=destin.getId()%>">
			<input type="hidden" name="userid" value="<%=userName%>">
			<tr>
				<td class="tdTitle"></td>
				<td>
					<div>
						<input class="input-btn-microsoft" type="submit" value="提交">
						<a class="a-btn-microsoft" href="javascript:XF.Destin.listDestin('<%=siteId%>')">取消</a>
					</div>
				</td>
			</tr>	
		</table>
	</form>
	<iframe id="_coreIframe" name="_coreIframe" style="display: none;"></iframe>
</div>
<div>
	<div class="breadcrumb">
		<div class="bcIcon"></div>
		<ul class="bcNav">
			<li style="color:red;">提示：</li>
		</ul>
	</div>
	<div >
	    <p style="padding: 20% 20px; width: 80%; height: 50px;font-size:15px;">县/市辖区若选项没有可以选择空白选项，把县/市辖区填入详细地址前面</p>
	</div>	
</div>
<script type="text/javascript">
	$('#prov').combobox({
		url:global.contextPath + '/destin/getProv',
		valueField:'id',
		textField:'val',
		editable:false,
		panelHeight:300,
		onSelect:function(record){
	        var url = global.contextPath + '/destin/getCity?prov=' + record.id; 
	        $('#city').combobox('reload', url);//联动下拉列表重载 
	    },
	    onHidePanel:function(){
			$('#city').combobox('clear'); //清除原来的数据  
			$('#area').combobox('clear');
	    }
	});
	$('#prov').combobox("setValue",'<%=null!=destin.getProv()?destin.getProv()+"":""%>');
	$('#city').combobox({
		valueField:'id',
		textField:'val',
		panelHeight: 300,
		editable:false,
		onSelect:function(record){
	        var url = global.contextPath + '/destin/getArea?city=' + record.id;  
	        $('#area').combobox('reload', url);//联动下拉列表重载 
	    },
	    onHidePanel:function(){
			$('#area').combobox('clear');
	    }
	});
	$('#city').combobox('setValue','<%=null!=destin.getCity()?destin.getCity()+"":""%>')
	$('#area').combobox({
		valueField:'id',
		textField:'val',								
		panelHeight: 300
	});
	$('#area').combobox('setValue','<%=null!=destin.getArea()?destin.getArea()+"":""%>')
	$(function() {
		$("input[name=areaname]").focus();//主动指定焦点，防止ie的bug			
	});
</script>


